//引入创建函数
import { createRouter, createWebHashHistory } from "vue-router";
//引入组件
import Login from "../components/LoginPage.vue";
import ShowVue from "../components/ShowVue.vue";
import Order from "../components/Order.vue";
import Shopping from "../components/ShopingVue.vue";
import ShoppingCar from "../components/ShoppingCar.vue";
import SaleOut from "../components/SaleOut.vue";
import ContentUS from "../components/ContentUS.vue";
import Admin from "../components/Admininstor.vue";

//admin的子路由
import AdminShopItem from "../components/adminsFiles/ShopItem.vue";
import AdminGetNewsFile from "../components/adminsFiles/GetNewsFile.vue";
import AdminChangeShopItemInfo from "../components/adminsFiles/ChangeShopItemInfo.vue";
//创建路由实例
const router = createRouter({
    history:createWebHashHistory(), //路由器的工作模式
    routes:[
        {
            path:'/order',
            component:Order
        },
        {
            path:'/',
            component:Login
        },
        {
            path:'/showVue',
            component:ShowVue
        },
        {
            path:'/shoppingcar',
            component:ShoppingCar
        },
        {
            path:'/saleOut',
            component:SaleOut
        },
        {
            path:'/content',
            component:ContentUS
        },
        {
            path:'/admin',
            component:Admin,
            children:[
                {
                    path:'shopItem',
                    component:AdminShopItem
                },
                {
                    path:'getNewsFile',
                    component:AdminGetNewsFile
                },
                {
                    path:'changeShopItemInfo',
                    component:AdminChangeShopItemInfo
                }
            ]
        },
        {
            path:'/Shop',
            component:Shopping,
        },
    ]
})

export default router
